<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
<script type="text/javascript" src="../lib/html5.js"></script>
<script type="text/javascript" src="../lib/respond.min.js"></script>
<script type="text/javascript" src="../lib/PIE_IE678.js"></script>
<![endif]-->
    <link href="../lib/layui/css/layui.css" rel="stylesheet" type="text/css" />
    <link href="../css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="../css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="../lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
    <link href="../lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
    <!--[if IE 6]>
<script type="text/javascript" src="../lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
    <title>投入品关联-生产农事</title>
</head>
<body>
    <div class="pt-5  pl-20 pr-20 pb-20">
        <form id="itemEdit" name="itemEdit" method="post" action="../ashx/spui.ashx" class="form form-horizontal">
            <input type="hidden" class="actionValue" id="editAction" name="action" value="addlist" />
            <input type="hidden" id="id" name="id" />
            <input type="hidden" id="actionaddlistids" name="actionaddlistids" value="ftaskid,fthistaskinfo,finfonv1,fzbpyl1,fzbpyl2,fzbpyl3,fzbpyl4" /><!--当为批量操作时（批量插入时）这几个数据为,分隔处理，作业批量的依据-->
            <input type="hidden" id="tablename" name="tablename" value="" />
            <input type="hidden" id="tablemidname" name="tablemidname" value="" />
            <input type="hidden" id="dataneedtouser" name="dataneedtouser" value="1" /><!--是否要包含通用数据必归属处理-->
            <input type="hidden" id="fpcgid" name="fpcgid" value="" /><!--用于关联出库的guid-->
            <!-- <input type="hidden" id="finfoid" name="finfoid" value="" />-->
            <input type="hidden" id="finfofv1" name="finfofv1" value="地信息" />
            <input type="hidden" class="input-text" name="fthistaskinfo" id="fthistaskinfo" value="任务信息" />
            <!--<input type="hidden" id="finfonv1" name="finfonv1" value="地MJ" />-->

            <input type="hidden" id="ftaskid" name="ftaskid" value="0" placeholder="任务ID" />

            <div id="tab-category" class="HuiTab">
                <div class="tabBar cl" id="tab-categorybar">
                    <span>
                        <label id="lb_worktypeshow">出库信息</label></span><span>作业图片信息</span><span>作业用料信息</span>
                </div>
                <div class="tabCon" id="divtab1">
                    <div id="divshow1">
                        <div class="row cl">
                            <label class="form-label col-1">作业类型：</label>
                            <div class="formControls col-2 layui-form" readonly="readonly">
                                <select name="finfotypeid" id='finfotypeid' lay-filter="finfotypeid" lay-search="" readonly="readonly">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                                <!-- <input type="hidden" id="finfotypeid" name="finfotypeid" value="" />-->
                                <input type="hidden" id="finfotypename" name="finfotypename" value="" />
                                <input type="hidden" id="finfotype" name="finfotype" value="" />
                                <input type="hidden" id="finfobytype1" name="finfobytype1" value="" />
                            </div>
                            <label class="form-label col-1">开始时间：</label>
                            <div class="formControls col-2">
                                <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd  HH:mm:ss'})" name="finfodt1" id="finfodt1" class="input-text Wdate" />
                            </div>

                            <label class="form-label col-1">结束时间：</label>
                            <div class="formControls col-2">
                                <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd  HH:mm:ss'})" name="finfodt2" id="finfodt2" class="input-text Wdate" />
                            </div>
                        </div>
                        <div class="row cl">
                            <div class=" col-9">
                                <label class="form-label col-1">天气：</label>
                                <div class="formControls  skin-minimal col-5">
                                    <div class="radio-box">
                                        <input type="radio" id="finfofv4" name="finfofv4" value="晴天" class="hcradio" checked="checked" />
                                        <label for="finfofv4">晴天</label>
                                    </div>
                                    <div class="radio-box">
                                        <input type="radio" id="finfofv42" name="finfofv4" value="阴天" />
                                        <label for="finfofv42">阴天</label>
                                    </div>
                                    <div class="radio-box">
                                        <input type="radio" id="finfofv43" name="finfofv4" value="雨天" />
                                        <label for="finfofv43">雨天</label>
                                    </div>
                                    <div class="radio-box">
                                        <input type="radio" id="finfofv44" name="finfofv4" value="其它" />
                                        <label for="finfofv44">其它</label>
                                    </div>
                                </div>

                                <label class="form-label col-1">目标：</label>
                                <div class="formControls  skin-minimal col-5">
                                    <div class="radio-box">
                                        <input type="radio" id="radioworkforall" name="raditworkforwhat" value="0" checked="checked" class="hcradio" />
                                        <label for="radioworkforall">整个地块</label>
                                    </div>
                                    <div class="radio-box">
                                        <input type="radio" id="raditworkfordc" name="raditworkforwhat" value="1" />
                                        <label for="raditworkfordc">地块的任务</label>
                                    </div>
                                </div>
                            </div>


                        </div>
                        <div class="row cl">
                            <label class="form-label col-1">地块信息：</label>
                            <!--  <div class="formControls col-3">
                                <input type="text" class="input-text" name="fmaindcinfo" id="fmaindcinfo" readonly="readonly" placeholder="右边选择或搜索选择" />
                            </div>-->
                            <div class="formControls col-5  layui-form">
                                <select name="finfoid" id='finfoid' lay-filter="finfoid" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                            </div>
                            <label class="form-label col-1">地块面积：</label>
                            <div class="formControls col-1">
                                <input type="text" class="input-text" name="showfinfonv1" id="showfinfonv1" placeholder="作业面积" value="0" />
                                <input type="hidden" class="input-text" name="finfonv1" id="finfonv1" placeholder="作业面积" value="0" />
                            </div>
                            <div class="form-label col-2">
                                任务数量： 
                                <label id="dctaskcount">0</label>
                            </div>

                            <div class="form-label col-2">
                                任务面积：
                                <label id="dctaskmjcount">0</label>
                            </div>

                        </div>

                        <div class="row cl" style="display: none;">
                            <label class="form-label col-1">任务信息：</label>

                            <div class="formControls col-5  layui-form">
                                <select name="selecttaskinfo" id='selecttaskinfo' lay-filter="selecttaskinfo" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                            </div>
                            <div class="formControls col-5">
                            </div>
                            <div class="col-1"></div>
                        </div>

                        <div class="row cl">



                            <label class="form-label col-1">作业人员：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="finfofv3" id="finfofv3" readonly="readonly" placeholder="右边选择或搜索选择" />
                                <input type="hidden" id="finfofv2" name="finfofv2" />
                            </div>
                            <div class="col-3 layui-form">
                                <select name="inoutusernamesel" id='inoutusernamesel' lay-filter="testselect" lay-verify="required" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-1">作业工具：</label>
                            <div class="col-2 layui-form">
                                <select name="finfofv5" id='finfofv5' lay-filter="testselect2" lay-verify="required" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                            </div>
                            <label class="form-label col-1">作业说明：</label>
                            <div class="formControls col-5">
                                <input type="text" class="input-text" name="finfofv6" id="finfofv6" />
                            </div>
                        </div>
                        <div class="row cl" style="display: none;">
                            <label class="form-label col-1">投入品2：</label>
                            <div class="col-2 layui-form">
                                <select name="ftjpid" id='ftjpid' lay-filter="ftjpid" lay-verify="required" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                                <input type="hidden" id="ftjpname" name="ftjpname" value="" />
                                <input type="hidden" id="ftjpunit" name="ftjpunit" value="" />
                            </div>
                            <label class="form-label col-1">投入量：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="ftjpcount" id="ftjpcount" placeholder="投入量" value="0" />
                            </div>
                            <label class="form-label col-1">单价：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="ftjpprice" id="ftjpprice" placeholder="单价" value="0" />
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-1" style="font-weight: bold; color: #0000FF;">投入品1：</label>
                            <div class="col-2 layui-form">
                                <select name="showfzbppcid1" id='showfzbppcid1' lay-filter="showfzbppcid1" lay-verify="required" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                                <input type="hidden" id="fzbppcid1" name="fzbppcid1" value="" />
                                <input type="hidden" id="fzbpid1" name="fzbpid1" value="" />
                                <input type="hidden" id="fzbpname1" name="fzbpname1" value="" />
                            </div>
                            <div class="col-5">
                                <input type="text" class="input-text" name="fzbpremark1" id="fzbpremark1" readonly="true" style="background-color: #cccccc;" />
                            </div>
                            <label class="form-label col-1">用量：</label>
                            <div class="formControls col-1">
                                <input type="text" class="input-text" name="showfzbpyl1" id="showfzbpyl1" placeholder="总入" value="0" />
                                <input type="hidden" class="input-text" name="fzbpyl1" id="fzbpyl1" placeholder="分开入量" value="0" />
                            </div>
                            <label class="form-label col-1">单价：</label>
                            <div class="formControls col-1">
                                <input type="text" class="input-text" name="fzbpdj1" id="fzbpdj1" placeholder="单价" value="0" />
                                <input type="hidden" class="input-text" name="fzbpbs1" id="fzbpbs1" placeholder="稀释倍数" value="0" />
                                <input type="hidden" class="input-text" name="fzbpunit1" id="fzbpunit1" placeholder="单位" value="0" />
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-1" style="font-weight: bold; color: #0000FF;">投入品2：</label>
                            <div class="col-2 layui-form">
                                <select name="showfzbppcid2" id='showfzbppcid2' lay-filter="showfzbppcid2" lay-verify="required" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                                <input type="hidden" id="fzbppcid2" name="fzbppcid2" value="" />
                                <input type="hidden" id="fzbpid2" name="fzbpid2" value="" />
                                <input type="hidden" id="fzbpname2" name="fzbpname2" value="" />
                            </div>
                            <div class="col-5">
                                <input type="text" class="input-text" name="fzbpremark2" id="fzbpremark2" readonly="true" style="background-color: #cccccc;" />
                            </div>
                            <label class="form-label col-1">用量：</label>
                            <div class="formControls col-1">
                                <input type="text" class="input-text" name="showfzbpyl2" id="showfzbpyl2" placeholder="总入" value="0" />
                                <input type="hidden" class="input-text" name="fzbpyl2" id="fzbpyl2" placeholder="分开入量" value="0" />
                            </div>
                            <label class="form-label col-1">单价：</label>
                            <div class="formControls col-1">
                                <input type="text" class="input-text" name="fzbpdj2" id="fzbpdj2" placeholder="单价" value="0" />
                                <input type="hidden" class="input-text" name="fzbpbs2" id="fzbpbs2" placeholder="稀释倍数" value="0" />
                                <input type="hidden" class="input-text" name="fzbpunit2" id="fzbpunit2" placeholder="单位" value="0" />
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-1" style="font-weight: bold; color: #0000FF;">投入品3：</label>
                            <div class="col-2 layui-form">
                                <select name="showfzbppcid3" id='showfzbppcid3' lay-filter="showfzbppcid3" lay-verify="required" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                                <input type="hidden" id="fzbppcid3" name="fzbppcid3" value="" />
                                <input type="hidden" id="fzbpid3" name="fzbpid3" value="" />
                                <input type="hidden" id="fzbpname3" name="fzbpname3" value="" />
                            </div>
                            <div class="col-5">
                                <input type="text" class="input-text" name="fzbpremark3" id="fzbpremark3" readonly="true" style="background-color: #cccccc;" />
                            </div>
                            <label class="form-label col-1">用量：</label>
                            <div class="formControls col-1">
                                <input type="text" class="input-text" name="showfzbpyl3" id="showfzbpyl3" placeholder="总入" value="0" />
                                <input type="hidden" class="input-text" name="fzbpyl3" id="fzbpyl3" placeholder="分开入量" value="0" />
                            </div>
                            <label class="form-label col-1">单价：</label>
                            <div class="formControls col-1">
                                <input type="text" class="input-text" name="fzbpdj3" id="fzbpdj3" placeholder="单价" value="0" />
                                <input type="hidden" class="input-text" name="fzbpbs3" id="fzbpbs3" placeholder="稀释倍数" value="0" />
                                <input type="hidden" class="input-text" name="fzbpunit3" id="fzbpunit3" placeholder="单位" value="0" />
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-1" style="font-weight: bold; color: #0000FF;">投入品4：</label>
                            <div class="col-2 layui-form">
                                <select name="showfzbppcid4" id='showfzbppcid4' lay-filter="showfzbppcid4" lay-verify="required" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                                <input type="hidden" id="fzbppcid4" name="fzbppcid4" value="" />
                                <input type="hidden" id="fzbpid4" name="fzbpid4" value="" />
                                <input type="hidden" id="fzbpname4" name="fzbpname4" value="" />
                            </div>
                            <div class="col-5">
                                <input type="text" class="input-text" name="fzbpremark4" id="fzbpremark4" readonly="true" style="background-color: #cccccc;" />
                            </div>
                            <label class="form-label col-1">用量：</label>
                            <div class="formControls col-1">
                                <input type="text" class="input-text" name="showfzbpyl4" id="showfzbpyl4" placeholder="总入" value="0" />
                                <input type="hidden" class="input-text" name="fzbpyl4" id="fzbpyl4" placeholder="分开入量" value="0" />
                            </div>
                            <label class="form-label col-1">单价：</label>
                            <div class="formControls col-1">
                                <input type="text" class="input-text" name="fzbpdj4" id="fzbpdj4" placeholder="单价" value="0" />
                                <input type="hidden" class="input-text" name="fzbpbs4" id="fzbpbs4" placeholder="稀释倍数" value="0" />
                                <input type="hidden" class="input-text" name="fzbpunit4" id="fzbpunit4" placeholder="单位" value="0" />
                            </div>
                        </div>
                        <div class="row cl" id="divshowdivinfofv10" style="display: none;">
                            <!--植保特殊数据-->
                            <label class="form-label col-1">防治对象：</label>
                            <div id="divinfofv10">
                            </div>
                        </div>
                        <div class="row cl" id="div1">
                            <label class="form-label col-1">工时：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="fworktime" id="fworktime" placeholder="工时" value="0" />
                            </div>
                            <label class="form-label col-1">工时单价：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="fworktimeprice" id="fworktimeprice" placeholder="工时单价" value="0" />
                            </div>
                        </div>


                    </div>
                </div>
                <div class="tabCon" id="divtab2">
                    <div id="divshow2">
                        <div class="row cl">
                            <input type="hidden" id="finfoimg1" name="finfoimg1" value="" />
                            <div class="col-5">作业图片1<img id="imgExist1" src="../defaultimg/hcrainaddimg.jpg" width="210px" height="250px"></div>
                            <div class="col-1">
                                <button onclick="addhcrainImgAll('finfoimg1','imgExist1');" class="btn btn-default radius" type="button">上传</button>
                            </div>

                            <input type="hidden" id="finfoimg2" name="finfoimg2" value="" />
                            <div class="col-5">作业图片2<img id="imgExist2" src="../defaultimg/hcrainaddimg.jpg" width="210px" height="250px"></div>
                            <div class="col-1">
                                <button onclick="addhcrainImgAll('finfoimg2','imgExist2');" class="btn btn-default radius" type="button">上传</button>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="tabCon" id="divtab3">
                    <div id="divshow3">
                        <div class="row cl">
                        </div>


                    </div>
                </div>
            </div>
            <div class="cl" style="display: none;" id="fold_category">
                <ul id="Huifold2" class="Huifold">
                    <li class="item">
                        <h4>基本设置<b>+</b></h4>
                        <div class="info" id="divfold1" style="display: block;">
                        </div>
                    </li>
                    <li class="item">
                        <h4>基本设置2<b>+</b></h4>
                        <div class="info" id="divfold2" style="display: block;">
                        </div>
                    </li>
                    <li class="item">
                        <h4>基本设置3<b>+</b></h4>
                        <div class="info" id="divfold3" style="display: block;"></div>
                    </li>
                </ul>
            </div>
            <div class="row cl">
                <div class="col-6 col-offset-4">
                    <!-- <button onclick="changeshowtype();" class="btn btn-danger radius" type="button">切换显示</button>&nbsp;&nbsp;&nbsp;&nbsp;-->
                    <button class="btn btn-primary radius" type="submit" id="btsub1">添加所有作业并同步库存</button>&nbsp;&nbsp;
                    <!--                    <button onclick="layer_close();" class="btn btn-default radius" type="button">返回</button>-->
                </div>
            </div>
            <div class="row cl">

                <div class="col-2"></div>
                <label class="form-label col-2">操作方式：</label>
                <div class="formControls  skin-minimal col-7">
                    <div class="check-box">
                        <input type="checkbox" id="c_dcinfo" name="c_dcinfo" value="1" />
                        <label for="ffv71">提交后，清空地块选择信息</label>
                    </div>
                    <div class="check-box" style="display: none;">
                        <input type="checkbox" id="c_taskinfo" name="c_taskinfo" value="2" />
                        <label for="ffv72">提交后，清空任务选择信息</label>
                    </div>

                </div>
            </div>

        </form>
    </div>
    <div class="pt-5  pl-20 pr-20 pb-20">
        <div class="row cl" id="divaddinfoshow">
            (提示，应选择类型，再选择地块，再选择所有投入品，再调整用量)操作记录：
        </div>
    </div>
    <script src="../hcjsui/Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../lib/layui/layui.js"></script>
    <script type="text/javascript" src="../lib/icheck/jquery.icheck.min.js"></script>
    <script type="text/javascript" src="../lib/Validform/5.3.2/Validform.js"></script>
    <script type="text/javascript" src="../lib/layer/1.9.3/layer.js"></script>
    <script src="../hcjsui/js/_Define.js" type="text/javascript"></script>
    <script type="text/javascript" src="../js/hcui.js"></script>
    <script type="text/javascript" src="../js/hcui_au.js"></script>
    <script type="text/javascript" src="ywjs/sctaskworklistnew.js"></script>
    <script type="text/javascript" src="../lib/My97DatePicker/WdatePicker.js"></script>


    <script type="text/javascript">
        var uiform = null;
        var divshowtype = 1;
        //加载处理
        spsetBaseNoBt("hsc_task_info", "id", "hsc_task_info as T", "*", "#tablelist", "hsc_task_info", "作业管理", "hsc_task_info");
        Mhcloadback[0] = "infotypename";
        Mhcloadback[1] = "infoimg1";
        Mhcloadback[2] = "infoimg2";
        Mhcloadback[3] = "infofv5";
        Mhcloadback[4] = "infofv7";
        Mhcloadback[5] = "infofv10";
        var selectworktypeinfo = [];
        var selectInfoDc = []; //地块信息
        var selectTaskInfo = []; //任务信息
        var fplantjpstoreinfo = []; //任务设入品信息
        //HcUiAuloadInfoAuto = false;//将自动加载，设置为false（禁用自动加载）
        var loadisOk = 0;
        var needstoreoutid = -1;//要同步出库 物品的库存ID
        var needstoreoutid2 = -1;
        var needstoreoutid3 = -1;
        var needstoreoutid4 = -1;
        //加载处理
        hcui_ajaxasync = false;
        function loadin() {
            $("#fpcgid").val(NewGuid());
            $("#finfodt1").val((new Date()).Format("yyyy-MM-dd hh:mm:ss"));//开始时间
            $("#finfodt2").val((addDate(new Date(), 1)).Format("yyyy-MM-dd hh:mm:ss"));//结束时间


            //地块信息
            hcdoselbyPost("id,concat(fv4,'-',fv1,'-',fv8,'-',fv9,'-',fv6) as name,nv1,fv1,fv8,fv10,fv7,fv9,fv6,fv4,fv11,fv12,fv13,fv14,fv15,fv16,fv17,fv18,fv19,fv20,fv21", "yw_baseinfo", "type=2 and maintype=2 and databranchid=" + HCUser.HCUorg, "", "", "id",
                   function (data) {
                       SetSelectWithArrayIdName("#finfoid", data);
                       selectInfoDc = data;
                       if (getUrlParam("urldcid")) {//指定加载
                           $('#finfoid').val(getUrlParam("urldcid"));
                           $('#finfofv1').val(hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv1);
                           $('#fthistaskinfo').val("");
                           $('#ftaskid').val("0");
                           $('#showfinfonv1').val(hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).nv1);

                           //if (getUrlParam("urltaskid")) hcdoselbyPost("id,concat(tasksctypename,'-',taskmj,'-',tasksctypename,'-',type,'-',taskno) as name,taskmj,sum(taskmj) allmj", "view进行中的任务", "id=" + getUrlParam("urltaskid"), "", "", "id",
                           //       function (data) {
                           //           selectTaskInfo = data;
                           //           $("#dctaskcount").text(selectTaskInfo.length);
                           //           if (data.length > 0) {
                           //               $('#dctaskmjcount').text(selectTaskInfo[0].allmj);
                           //           }
                           //       });
                       }
                   });
            //防治对象
            hcdoselbyPost("t1.id  as id,t1.fv1 as name", "yw_baseinfo as t1", "t1.type=9 and t1.maintype=9 and t1.databranchid=" + HCUser.HCUorg, "", "", "id", function (data) {
                SetCheckBoxsInfo("#divinfofv10", "finfofv10", data);
            });


            //作业类型
            hcdoselbyPost("id,fv1 as name,fv3,fv4", "yw_baseinfo", "type='4' and  maintype='4' and fv3<>'1' and fv3 in ('4','7','8')", "", "", "id",
             function (data) {
                 SetSelectWithArrayIdName("#finfotypeid", data);
                 selectworktypeinfo = data;
                 //if (getUrlParam("urlworktype")) {
                 //    $("#finfotypeid").val(getUrlParam("urlworktype"));
                 //    $('#finfotypename').val(hcgetJsonObjById(selectworktypeinfo, $("#finfotypeid").val()).name);
                 //    $('#finfotype').val(hcgetJsonObjById(selectworktypeinfo, $("#finfotypeid").val()).fv3);//一级
                 //    $('#finfobytype1').val(hcgetJsonObjById(selectworktypeinfo, $("#finfotypeid").val()).fv4);//二级
                 //    // loadworkggfv5fv7(false, false, false);
                 //}
                 if (uiform) uiform.render('select');
             });
            //人员下拉加载 
            hcdoselbyPost("empid  as id,concat(depname,'-',empname) as name,empname as username,mobile as  tel,depname as address", "view_user", "branchid='" + HCUser.HCUorg + "'", "", "", "id",
                function (data) {
                    SetSelectWithArrayIdName("#inoutusernamesel", data);
                    if (uiform) uiform.render('select');

                    loadworkuser();

                });
            //hcdoselbyPost("id,concat(infofv1,tasksctypename,'-',taskmj,'-',type,'-',taskno) as name,taskmj,infoid", "view进行中的任务", "databranchid=" + HCUser.HCUorg, "", "", "id",
            //       function (data) {
            //           selectTaskInfo = data;
            //           data.splice(0, 0, { "id": "0", "name": "不指定任务" });
            //           SetSelectWithArrayIdName("#selecttaskinfo", data);
            //           ////默认加第2个
            //           //if (data.length > 1) {
            //           //    $('#ftaskid').val(selectTaskInfo[1].id);
            //           //    $('#fthistaskinfo').val(selectTaskInfo[1].name);
            //           //    $('#finfonv1').val(selectTaskInfo[1].taskmj);
            //           //}
            //           // if (uiform) uiform.render('select');
            //       });
            //加载作业人员 后 并 加载作业工具
            function loadworkuser() {
                if ($('#finfotype').val() == "") return;
                var worktypenum = $('#finfotype').val();//作业类型
                var workdcid = $('#finfoid').val();//作业地块
                var workuserid = null;
                if (worktypenum == "3" && hcgetJsonObjById(selectInfoDc, workdcid).fv11) {//作业人员ID
                    workuserid = hcgetJsonObjById(selectInfoDc, workdcid).fv11;
                }
                else if (worktypenum == "4" && hcgetJsonObjById(selectInfoDc, workdcid).fv13) {
                    workuserid = hcgetJsonObjById(selectInfoDc, workdcid).fv13;
                }
                else if (worktypenum == "5" && hcgetJsonObjById(selectInfoDc, workdcid).fv12) {
                    workuserid = hcgetJsonObjById(selectInfoDc, workdcid).fv12;
                }
                else if (worktypenum == "6" && hcgetJsonObjById(selectInfoDc, workdcid).fv17) {
                    workuserid = hcgetJsonObjById(selectInfoDc, workdcid).fv17;
                }
                else if (worktypenum == "7" && hcgetJsonObjById(selectInfoDc, workdcid).fv14) {
                    workuserid = hcgetJsonObjById(selectInfoDc, workdcid).fv14;
                }
                else if (worktypenum == "8" && hcgetJsonObjById(selectInfoDc, workdcid).fv15) {
                    workuserid = hcgetJsonObjById(selectInfoDc, workdcid).fv15;
                }
                else if (worktypenum == "9" && hcgetJsonObjById(selectInfoDc, workdcid).fv18) {
                    workuserid = hcgetJsonObjById(selectInfoDc, workdcid).fv18;
                }
                else if (worktypenum == "10" && hcgetJsonObjById(selectInfoDc, workdcid).fv16) {
                    workuserid = hcgetJsonObjById(selectInfoDc, workdcid).fv16;
                }
                else if (worktypenum == "11" && hcgetJsonObjById(selectInfoDc, workdcid).fv19) {
                    workuserid = hcgetJsonObjById(selectInfoDc, workdcid).fv19;
                }
                else if (worktypenum == "12" && hcgetJsonObjById(selectInfoDc, workdcid).fv20) {
                    workuserid = hcgetJsonObjById(selectInfoDc, workdcid).fv20;
                } else if (worktypenum == "13" && hcgetJsonObjById(selectInfoDc, workdcid).fv21) {
                    workuserid = hcgetJsonObjById(selectInfoDc, workdcid).fv21;
                }
                if (workuserid) {
                    $("#inoutusernamesel").val(workuserid);
                    $('#finfofv2').val(workuserid);
                    $('#finfofv3').val($("#inoutusernamesel").find("option:selected").text());
                }
                else {
                    //默认的人员
                    $("#inoutusernamesel").val(HCUser.HCUide);
                    $('#finfofv2').val(HCUser.HCUide);
                    $('#finfofv3').val($("#inoutusernamesel").find("option:selected").text());
                }
                //加载作业工具
                loadworkgj(worktypenum, workdcid);
                //加载作业可用投入品
                loadworktjp(worktypenum, workdcid);
                uiform.render('select');

            }



            if (uiform) uiform.render('select');
            layui.use(['form'], function () {
                uiform = layui.form();
                uiform.on('select(testselect)', function (data) {
                    $('#finfofv2').val(data.value);
                    $('#finfofv3').val($("#inoutusernamesel").find("option:selected").text());
                });
                //类型选择
                uiform.on('select(finfotypeid)', function (data) {
                    //$('#finfoid').val("");
                    //$('#finfofv1').val("");
                    //$('#fthistaskinfo').val("");
                    //$('#ftaskid').val("0");
                    //$('#finfonv1').val(0);
                    //$('#selecttaskinfo').val("");
                    $('#finfotypename').val(hcgetJsonObjById(selectworktypeinfo, data.value).name);
                    $('#finfotype').val(hcgetJsonObjById(selectworktypeinfo, data.value).fv3);//一级
                    $('#finfobytype1').val(hcgetJsonObjById(selectworktypeinfo, data.value).fv4);//二级
                    //loadworkggfv5fv7(false, false, false); 
                    if ($('#finfotype').val() == "8") {
                        $("#divshowdivinfofv10").show();
                    }
                    else { $("#divshowdivinfofv10").hide(); }

                    loadworkuser();
                    if (uiform) uiform.render('select');

                });
                //选择投入品
                uiform.on('select(ftjpid)', function (data) {
                    // $('#finfotypeid').val(data.value);
                    $('#ftjpname').val(hcgetJsonObjById(ftjpidobjinfo, data.value).pname);
                    $('#ftjpunit').val(hcgetJsonObjById(ftjpidobjinfo, data.value).unit);
                });

                //地块选择
                uiform.on('select(finfoid)', function (data) {
                    $('#finfoid').val(data.value);
                    $('#finfofv1').val(hcgetJsonObjById(selectInfoDc, data.value).fv1);
                    $('#fthistaskinfo').val("");
                    $('#ftaskid').val("0");
                    $('#showfinfonv1').val(hcgetJsonObjById(selectInfoDc, data.value).nv1);

                    $('#ftaskid').val("0");
                    $('#fthistaskinfo').val("");
                    $('#selecttaskinfo').val("");
                    //实时加载这个地块上的任务
                    hcdoselbyPost("id,concat(tasksctypename,'-',taskmj,'-',tasksctypename,'-',type,'-',taskno) as name,taskmj", "view进行中的任务", "infoid=" + data.value, "", "", "id",
                               function (data) {
                                   selectTaskInfo = data;
                                   $("#dctaskcount").text(selectTaskInfo.length);
                                   var allmjsum = 0;
                                   $.each(selectTaskInfo, function (i, item) {
                                       allmjsum += item.taskmj * 1;
                                   });
                                   $('#dctaskmjcount').text(allmjsum);
                               });
                    loadworkuser();
                    reloadtjpinfo(false);
                    ////任务信息
                    //hcdoselbyPost("id,concat(tasksctypename,'-',taskmj,'-',tasksctypename,'-',type,'-',taskno) as name,taskmj", "view进行中的任务", "infoid=" + data.value, "", "", "id",
                    //       function (data) {
                    //           selectTaskInfo = data;
                    //           data.splice(0, 0, { "id": "0", "name": "不指定任务" });
                    //           SetSelectWithArrayIdName("#selecttaskinfo", data);
                    //           //默认加第2个
                    //           if (data.length > 1) {
                    //               $('#ftaskid').val(selectTaskInfo[1].id);
                    //               $('#fthistaskinfo').val(selectTaskInfo[1].name);
                    //               $('#finfonv1').val(selectTaskInfo[1].taskmj);
                    //           }
                    //           if (uiform) uiform.render('select');
                    //       });
                    if (uiform) uiform.render('select');

                    //任务信息
                    //hcdoselbyPost("id,concat(tasksctypename,'-',taskmj,'-',tasksctypename,'-',type,'-',taskno) as name,taskmj", "view进行中的任务", "infoid=" + data.value, "", "", "id",
                    //       function (data) {
                    //           selectTaskInfo = data;
                    //           data.splice(0, 0, { "id": "0", "name": "不指定任务" });
                    //           SetSelectWithArrayIdName("#selecttaskinfo", data);
                    //           //默认加第2个
                    //           if (data.length > 1) {
                    //               $('#ftaskid').val(selectTaskInfo[1].id);
                    //               $('#fthistaskinfo').val(selectTaskInfo[1].name);
                    //               $('#finfonv1').val(selectTaskInfo[1].taskmj);
                    //           }
                    //           if (uiform) uiform.render('select');
                    //       });
                });

                ////选择任务
                //uiform.on('select(selecttaskinfo)', function (data) {

                //    $('#ftaskid').val(data.value);
                //    $('#finfonv1').val(hcgetJsonObjById(selectTaskInfo, data.value).taskmj);
                //    $('#fthistaskinfo').val(hcgetJsonObjById(selectTaskInfo, data.value).name);
                //    var thisdcid = hcgetJsonObjById(selectTaskInfo, data.value).infoid;
                //    $('#finfoid').val(thisdcid);
                //    $('#finfofv1').val(hcgetJsonObjById(selectInfoDc, thisdcid).fv1);

                //    //$('#finfonv1').val(hcgetJsonObjById(selectInfoDc, thisdcid).nv1);
                //    if (uiform) uiform.render('select');

                //    loadworkuser();

                //});
                //选择计划的投入品
                //uiform.on('select(showfzbppcid1)', function (data) {
                //    $('#fzbppcid1').val(data.value);
                //    needstoreoutid = data.value;
                //    $('#fzbpid1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).spid);
                //    $('#fzbpname1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).spname);
                //    $('#fzbpremark1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).name);
                //    $('#fzbpbs1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).ssbs);
                //    //$('#alljbp').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).count);
                //    $('#fzbpdj1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).price);
                //    $('#fzbpunit1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).unit);
                //    alert(hcgetJsonObjById(fplantjpstoreinfo, data.value).canoutobj);
                //    reloadtjpinfo(false);
                //});
                //uiform.on('select(showfzbppcid1)', function (data) {
                //    $('#fzbppcid1').val(data.value);
                //    needstoreoutid = data.value;
                //    $('#fzbpid1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).spid);
                //    $('#fzbpname1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).spname);
                //    $('#fzbpremark1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).name);
                //    $('#fzbpbs1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).ssbs);
                //    //$('#alljbp').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).count);
                //    $('#fzbpdj1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).price);
                //    $('#fzbpunit1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).unit);
                //    reloadtjpinfo(false);
                //});
                uiform.on('select(showfzbppcid1)', function (data) {
                    $('#fzbppcid1').val(data.value);
                    needstoreoutid = data.value;
                    $('#fzbpid1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).spid);
                    $('#fzbpname1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).spname);
                    $('#fzbpremark1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).name);
                    $('#fzbpbs1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).ssbs);
                    //$('#alljbp').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).count);
                    $('#fzbpdj1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).price);
                    $('#fzbpunit1').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).unit);
                    setCheckbox("finfofv10", hcgetJsonObjById(fplantjpstoreinfo, data.value).canoutobj)
                    reloadtjpinfo(false);
                });
                uiform.on('select(showfzbppcid2)', function (data) {
                    $('#fzbppcid2').val(data.value);
                    needstoreoutid2 = data.value;
                    $('#fzbpid2').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).spid);
                    $('#fzbpname2').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).spname);
                    $('#fzbpremark2').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).name);
                    $('#fzbpbs2').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).ssbs);
                    $('#fzbpdj2').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).price);
                    $('#fzbpunit2').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).unit);
                    setCheckbox("finfofv10", hcgetJsonObjById(fplantjpstoreinfo, data.value).canoutobj)
                    reloadtjpinfo(false);
                });
                uiform.on('select(showfzbppcid3)', function (data) {
                    $('#fzbppcid3').val(data.value);
                    needstoreoutid3 = data.value;
                    $('#fzbpid3').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).spid);
                    $('#fzbpname3').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).spname);
                    $('#fzbpremark3').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).name);
                    $('#fzbpbs3').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).ssbs);
                    $('#fzbpdj3').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).price);
                    $('#fzbpunit3').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).unit);
                    setCheckbox("finfofv10", hcgetJsonObjById(fplantjpstoreinfo, data.value).canoutobj)
                    reloadtjpinfo(false);
                });
                uiform.on('select(showfzbppcid4)', function (data) {
                    $('#fzbppcid4').val(data.value);
                    needstoreoutid4 = data.value;
                    $('#fzbpid4').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).spid);
                    $('#fzbpname4').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).spname);
                    $('#fzbpremark4').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).name);
                    $('#fzbpbs4').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).ssbs);
                    $('#fzbpdj4').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).price);
                    $('#fzbpunit4').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).unit);
                    setCheckbox("finfofv10", hcgetJsonObjById(fplantjpstoreinfo, data.value).canoutobj)
                    reloadtjpinfo(false);
                });
                uiform.render('select');
            });
            $('input[type=radio][name=raditworkforwhat]').change(function () {
                reloadtjpinfo(false);
            });

            $.Huitab("#tab-category .tabBar span", "#tab-category .tabCon", "current", "click", "0");
            $.Huifold("#Huifold2 .item h4", "#Huifold2 .item .info", "", 3, "click"); /*5个参数顺序不可打乱，分别是：相应区,隐藏显示的内容,速度,类型,事件 mouseover click */

        }
        //加载作业人员 后 的  加载作业工具
        function loadworkgj(worktypenum, workdcid) {
            //工具
            hcdoselbyPost("t1.id  as id,concat(t1.fv3,'-',t1.fv4) as name", "yw_baseinfo as t1  INNER JOIN yw_baseinfo as t2 on  t1.fv1=t2.id", "t1.type=8 and t1.maintype=8 and t1.databranchid=" + HCUser.HCUorg + " and t2.fv3 in(" + $("#finfotype").val() + ")", "", "", "t1.id", function (data) {
                SetSelectWithArrayIdName("#finfofv5", data);
                if (data.length > 0) {
                    $('#finfofv5').val(data[0].id);
                }
            });
        }
        //加载作业人员 后 的  加载作业投入品
        function loadworktjp(worktypenum, workdcid) {

            //加载的库存信息
            hcdoselbyPost("p.canoutobj,p.id as spid,p.ssbs,p.canoutobj,p.dhmjcount,l.id,concat(l.spname,'批次:',l.spbasepc,'-厂家:',l.spbasecj,'-库存:',l.count-l.hasout ,'-生产日期:',case when l.spbasecdate  is null  then '' else   DATE_FORMAT(l.spbasecdate,'%Y-%m-%d') END  ) as name,l.spmaintype, l.spid, l.spname, l.price, l.spbasecj, l.spbasezj, l.spbasepc, l.spbasecdate, l.spbasedesc, l.unit,l.storeid,l.count-l.hasout as count", "herp_inoutorderlist as l inner join herp_product as p on l.spid = p.id  ", "l.databranchid='" + HCUser.HCUorg + "'   and l.datastate='入库' and l.count-l.hasout>0 and p.worktypeid in (0," + $("#finfotype").val() + ")", "", "", "l.dataaddtime asc", function (datab) {
                SetSelectWithArrayIdName("#showfzbppcid1", datab);
                SetSelectWithArrayIdName("#showfzbppcid2", datab);
                SetSelectWithArrayIdName("#showfzbppcid3", datab);
                SetSelectWithArrayIdName("#showfzbppcid4", datab);
                fplantjpstoreinfo = datab;

            });
        }
        function reloadtjpinfo(issubmit) {
            //计算总用量
            var dcmjall = $('#showfinfonv1').val();//地面积
            var taskmjall = $('#dctaskmjcount').html();//所有信息的面积
            var needmj = dcmjall * 1;//确认要用的面积
            var addbylist = false;
            if ($('input[name="raditworkforwhat"]:checked').val() == "1") {     //按任务分配
                needmj = taskmjall * 1;

                addbylist = true;
                var nv1info = "";
                var taskids = "";
                var taskinfos = "";
                $.each(selectTaskInfo, function (i, item) {
                    nv1info = nv1info + item.taskmj + ",";
                    taskids = taskids + item.id + ",";
                    taskinfos = taskinfos + item.name.replaceAll(',', '').replaceAll('，', '') + ",";
                });
                $('#finfonv1').val(nv1info);
                $('#ftaskid').val(taskids);
                $('#fthistaskinfo').val(taskinfos);
            }
            else {
                $('#ftaskid').val(0);
                $('#finfonv1').val(needmj);
                $('#fthistaskinfo').val("");
            }

            if (needstoreoutid >= 0)//选择的库存品
            {
                var dhmjcount = hcgetJsonObjById(fplantjpstoreinfo, needstoreoutid).dhmjcount;//单位面积用量
                if (!issubmit) $('#showfzbpyl1').val(1 * dhmjcount * needmj);//提交前再算一次，便用量不能再算
                if (addbylist) {
                    var allneedpj1 = $('#showfzbpyl1').val();//总用量
                    var taskneedpj1 = "";
                    $.each(selectTaskInfo, function (i, item) {
                        if (needmj == 0) taskneedpj1 = taskneedpj1 + 0 + ",";
                        else
                            taskneedpj1 = taskneedpj1 + ((allneedpj1 / needmj) * item.taskmj) + ",";
                    });
                    $('#fzbpyl1').val(taskneedpj1);
                }
                else {
                    if (!issubmit) $('#fzbpyl1').val(1 * dhmjcount * needmj);
                    else $('#fzbpyl1').val($('#showfzbpyl1').val());//总用量
                }

            }
            if (needstoreoutid2 >= 0)//选择的库存品
            {
                var dhmjcount = hcgetJsonObjById(fplantjpstoreinfo, needstoreoutid2).dhmjcount;//单位面积用量
                if (!issubmit) $('#showfzbpyl2').val(1 * dhmjcount * needmj);//提交前再算一次，便用量不能再算
                if (addbylist) {
                    var allneedpj1 = $('#showfzbpyl2').val();//总用量
                    var taskneedpj1 = "";
                    $.each(selectTaskInfo, function (i, item) {
                        if (needmj == 0) taskneedpj1 = taskneedpj1 + 0 + ",";
                        else
                            taskneedpj1 = taskneedpj1 + ((allneedpj1 / needmj) * item.taskmj) + ",";
                    });
                    $('#fzbpyl2').val(taskneedpj1);
                }
                else {
                    if (!issubmit) $('#fzbpyl2').val(1 * dhmjcount * needmj);
                    else $('#fzbpyl2').val($('#showfzbpyl2').val());//总用量
                }
            }
            if (needstoreoutid3 >= 0)//选择的库存品
            {
                var dhmjcount = hcgetJsonObjById(fplantjpstoreinfo, needstoreoutid3).dhmjcount;//单位面积用量
                if (!issubmit) $('#showfzbpyl3').val(1 * dhmjcount * needmj);//提交前再算一次，便用量不能再算
                if (addbylist) {
                    var allneedpj1 = $('#showfzbpyl3').val();//总用量
                    var taskneedpj1 = "";
                    $.each(selectTaskInfo, function (i, item) {
                        if (needmj == 0) taskneedpj1 = taskneedpj1 + 0 + ",";
                        else
                            taskneedpj1 = taskneedpj1 + ((allneedpj1 / needmj) * item.taskmj) + ",";
                    });
                    $('#fzbpyl3').val(taskneedpj1);
                }
                else {
                    if (!issubmit) $('#fzbpyl3').val(1 * dhmjcount * needmj);
                    else $('#fzbpyl3').val($('#showfzbpyl3').val());//总用量
                }
            }
            if (needstoreoutid4 >= 0)//选择的库存品
            {
                var dhmjcount = hcgetJsonObjById(fplantjpstoreinfo, needstoreoutid4).dhmjcount;//单位面积用量
                if (!issubmit) $('#showfzbpyl4').val(1 * dhmjcount * needmj);//提交前再算一次，便用量不能再算
                if (addbylist) {
                    var allneedpj1 = $('#showfzbpyl4').val();//总用量
                    var taskneedpj1 = "";
                    $.each(selectTaskInfo, function (i, item) {
                        if (needmj == 0) taskneedpj1 = taskneedpj1 + 0 + ",";
                        else
                            taskneedpj1 = taskneedpj1 + ((allneedpj1 / needmj) * item.taskmj) + ",";
                    });
                    $('#fzbpyl4').val(taskneedpj1);
                }
                else {
                    if (!issubmit) $('#fzbpyl4').val(1 * dhmjcount * needmj);
                    else $('#fzbpyl4').val($('#showfzbpyl4').val());//总用量
                }
            }
            //          `ssbs` double(10,2) NOT NULL DEFAULT '1.00' COMMENT '稀释倍数',
            //`canoutobj` varchar(200) DEFAULT NULL COMMENT '可以防治对',
            //`dhmjcount` double(10,2) DEFAULT NULL COMMENT '单位面积亩使用量',
        }
        function loadback(data) {
            uiform.render();//这个不能去掉,坑啊
            $("#lb_worktypeshow").html(data["infotypename"] + "作业");//显示作业
            if (data["infoimg1"]) hcrainloadimg("#imgExist1", data["infoimg1"]);
            if (data["infoimg2"]) hcrainloadimg("#imgExist2", data["infoimg2"]);

            hcdoselbyPost("taskstatus", "hsc_task", "id='" + $("#ftaskid").val() + "'", "", "", "id", function (data) {
                if (data[0].taskstatus == "完成" || data[0].taskstatus == "中止") { $("#btsub1").hide(); }
            });
        }
        //切换事件
        function changeshowtype() {
            if (divshowtype == 1) {
                $("#divshow1").appendTo("#divfold1");
                $("#divshow2").appendTo("#divfold2");
                $("#divshow3").appendTo("#divfold3");
                $("#fold_category").show();
                $("#tab-category").hide();

                divshowtype = 2;
            }
            else {
                $("#divshow1").appendTo("#divtab1");
                $("#divshow2").appendTo("#divtab2");
                $("#divshow3").appendTo("#divtab3");
                $("#fold_category").hide();
                $("#tab-category").show();
                divshowtype = 1;
            }

        }
        //重写  提交前数据处理
        function hcrBeforeSub() {

            $("#editAction").val("addlist");
            //$("#fareaname").val($('#fareaid option:selected').text());
            if ($("#finfotypeid").val() == "") {
                layer.msg("请选择作业类型", { icon: 5 });
                return false;
            }
            if ($("#finfoid").val() == "") {
                layer.msg("请选择地块信息", { icon: 5 });
                return false;
            }
            if ($('#finfotype').val() == "13" && ($("#ftaskid").val() == "" || $("#ftaskid").val() == "0")) {
                layer.msg("结束作业类型-任务信息不能为空", { icon: 5 });
                return false;
            }
            reloadtjpinfo(true);
        }



        //提交数据后,回调
        function subback(data) {
            if (data.status == "y") {
                if ($("#fzbppcid1").val() != "" && $("#fzbppcid1").val() > 0 && $("#showfzbpyl1").val() > 0) {//投入品1使用
                    var typ1id = $("#fzbppcid1").val();
                    var thistypinfo = hcgetJsonObjById(fplantjpstoreinfo, typ1id);
                    //l.spmaintype, l.spid, l.spname, l.price, l.spbasecj, l.spbasezj, l.spbasepc, l.spbasecdate, l.spbasedesc, l.unit
                    var addinfo = "gid%" + NewGuid()
                   + "$ordergid%" + $("#fpcgid").val()
                   + "$spmaintype%" + thistypinfo.spmaintype
                   + "$spid%" + thistypinfo.spid
                   + "$spname%" + thistypinfo.spname
                   + "$count%" + $("#showfzbpyl1").val()
                   + "$price%" + thistypinfo.price
                    + "$spbasecj%" + thistypinfo.spbasecj
                   + "$spbasezj%" + thistypinfo.spbasezj
                   + "$spbasepc%" + thistypinfo.spbasepc
                   + "$spbasecdate%" + thistypinfo.spbasecdate
                   + "$fromid%" + typ1id//这里为库存ID
                   + "$totaskid%" + $("#finfoid").val()//这里用地块ID
                   + "$totaskinfo%" + $("#finfoid").find("option:selected").text()//这里用地块
                   + "$spbasedesc%" + thistypinfo.spbasedesc
                   + "$hasout%0" + "$state%作业直接出库" + "$datastate%出库"
                   + "$unit%" + thistypinfo.unit;
                    hcdoadd201702("herp_inoutorderlist", addinfo, 1, "", "", function (info) {
                        if (info == "ok") {
                            //更新入库 
                            hcdoedit("herp_inoutorderlist", "id", typ1id, "hasout%hcrainself(hasout+" + $('#showfzbpyl1').val() + ")", function (info2) {
                            });
                            hcdosel("id", "herp_store", "storehouseid=" + thistypinfo.storeid + " and productid=" + thistypinfo.spid, "", "", "id", function (dataid) {
                                var dataidinfo = JSON.parse(dataid);
                                //更新库存
                                hcdoedit("herp_store", "id", dataidinfo[0].id, "hasoutall%hcrainself(hasoutall+" + $('#showfzbpyl1').val() + ")", function (info2) {

                                });
                            });

                        }
                    });
                }
                if ($("#fzbppcid2").val() != "" && $("#fzbppcid2").val() > 0 && $("#showfzbpyl2").val() > 0) {//投入品1使用
                    var typ1id = $("#fzbppcid2").val();
                    var thistypinfo = hcgetJsonObjById(fplantjpstoreinfo, typ1id);
                    var addinfo = "gid%" + NewGuid()
                   + "$ordergid%" + $("#fpcgid").val()
                   + "$spmaintype%" + thistypinfo.spmaintype
                   + "$spid%" + thistypinfo.spid
                   + "$spname%" + thistypinfo.spname
                   + "$count%" + $("#showfzbpyl2").val()
                   + "$price%" + thistypinfo.price
                    + "$spbasecj%" + thistypinfo.spbasecj
                   + "$spbasezj%" + thistypinfo.spbasezj
                   + "$spbasepc%" + thistypinfo.spbasepc
                   + "$spbasecdate%" + thistypinfo.spbasecdate
                   + "$fromid%" + typ1id//这里为库存ID
                   + "$totaskid%" + $("#finfoid").val()//这里用地块ID
                   + "$totaskinfo%" + $("#finfoid").find("option:selected").text()//这里用地块
                   + "$spbasedesc%" + thistypinfo.spbasedesc
                   + "$hasout%0" + "$state%作业直接出库" + "$datastate%出库"
                   + "$unit%" + thistypinfo.unit;
                    hcdoadd201702("herp_inoutorderlist", addinfo, 1, "", "", function (info) {
                        if (info == "ok") {
                            //更新入库
                            hcdoedit("herp_inoutorderlist", "id", typ1id, "hasout%hcrainself(hasout+" + $('#showfzbpyl2').val() + ")", function (info2) {
                            });
                            hcdosel("id", "herp_store", "storehouseid=" + thistypinfo.storeid + " and productid=" + thistypinfo.spid, "", "", "id", function (dataid) {
                                var dataidinfo = JSON.parse(dataid);
                                //更新库存
                                hcdoedit("herp_store", "id", dataidinfo[0].id, "hasoutall%hcrainself(hasoutall+" + $('#showfzbpyl2').val() + ")", function (info2) {

                                });
                            });

                        }
                    });
                }
                if ($("#fzbppcid3").val() != "" && $("#fzbppcid3").val() > 0 && $("#showfzbpyl3").val() > 0) {//投入品1使用
                    var typ1id = $("#fzbppcid3").val();
                    var thistypinfo = hcgetJsonObjById(fplantjpstoreinfo, typ1id);
                    //l.spmaintype, l.spid, l.spname, l.price, l.spbasecj, l.spbasezj, l.spbasepc, l.spbasecdate, l.spbasedesc, l.unit
                    var addinfo = "gid%" + NewGuid()
                   + "$ordergid%" + $("#fpcgid").val()
                   + "$spmaintype%" + thistypinfo.spmaintype
                   + "$spid%" + thistypinfo.spid
                   + "$spname%" + thistypinfo.spname
                   + "$count%" + $("#showfzbpyl3").val()
                   + "$price%" + thistypinfo.price
                    + "$spbasecj%" + thistypinfo.spbasecj
                   + "$spbasezj%" + thistypinfo.spbasezj
                   + "$spbasepc%" + thistypinfo.spbasepc
                   + "$spbasecdate%" + thistypinfo.spbasecdate
                   + "$fromid%" + typ1id//这里为库存ID
                   + "$totaskid%" + $("#finfoid").val()//这里用地块ID
                   + "$totaskinfo%" + $("#finfoid").find("option:selected").text()//这里用地块
                   + "$spbasedesc%" + thistypinfo.spbasedesc
                   + "$hasout%0" + "$state%作业直接出库" + "$datastate%出库"
                   + "$unit%" + thistypinfo.unit;
                    hcdoadd201702("herp_inoutorderlist", addinfo, 1, "", "", function (info) {
                        if (info == "ok") {
                            //更新入库
                            hcdoedit("herp_inoutorderlist", "id", typ1id, "hasout%hcrainself(hasout+" + $('#showfzbpyl3').val() + ")", function (info2) {
                            });
                            hcdosel("id", "herp_store", "storehouseid=" + thistypinfo.storeid + " and productid=" + thistypinfo.spid, "", "", "id", function (dataid) {
                                var dataidinfo = JSON.parse(dataid);
                                //更新库存
                                hcdoedit("herp_store", "id", dataidinfo[0].id, "hasoutall%hcrainself(hasoutall+" + $('#showfzbpyl3').val() + ")", function (info2) {

                                });
                            });

                        }
                    });
                }
                if ($("#fzbppcid4").val() != "" && $("#fzbppcid4").val() > 0 && $("#showfzbpyl4").val() > 0) {//投入品1使用
                    var typ1id = $("#fzbppcid4").val();
                    var thistypinfo = hcgetJsonObjById(fplantjpstoreinfo, typ1id);
                    //l.spmaintype, l.spid, l.spname, l.price, l.spbasecj, l.spbasezj, l.spbasepc, l.spbasecdate, l.spbasedesc, l.unit
                    var addinfo = "gid%" + NewGuid()
                   + "$ordergid%" + $("#fpcgid").val()
                   + "$spmaintype%" + thistypinfo.spmaintype
                   + "$spid%" + thistypinfo.spid
                   + "$spname%" + thistypinfo.spname
                   + "$count%" + $("#showfzbpyl4").val()
                   + "$price%" + thistypinfo.price
                    + "$spbasecj%" + thistypinfo.spbasecj
                   + "$spbasezj%" + thistypinfo.spbasezj
                   + "$spbasepc%" + thistypinfo.spbasepc
                   + "$spbasecdate%" + thistypinfo.spbasecdate
                   + "$fromid%" + typ1id//这里为库存ID
                   + "$totaskid%" + $("#finfoid").val()//这里用地块ID
                   + "$totaskinfo%" + $("#finfoid").find("option:selected").text()//这里用地块
                   + "$spbasedesc%" + thistypinfo.spbasedesc
                   + "$hasout%0" + "$state%作业直接出库" + "$datastate%出库"
                   + "$unit%" + thistypinfo.unit;
                    hcdoadd201702("herp_inoutorderlist", addinfo, 1, "", "", function (info) {
                        if (info == "ok") {
                            //更新入库
                            hcdoedit("herp_inoutorderlist", "id", typ1id, "hasout%hcrainself(hasout+" + $('#showfzbpyl4').val() + ")", function (info2) {
                            });
                            hcdosel("id", "herp_store", "storehouseid=" + thistypinfo.storeid + " and productid=" + thistypinfo.spid, "", "", "id", function (dataid) {
                                var dataidinfo = JSON.parse(dataid);
                                //更新库存
                                hcdoedit("herp_store", "id", dataidinfo[0].id, "hasoutall%hcrainself(hasoutall+" + $('#showfzbpyl4').val() + ")", function (info2) {

                                });
                            });

                        }
                    });
                }
                $("#fpcgid").val(NewGuid());
                loadworktjp(0, 0);
                if (uiform) uiform.render('select');
                $("#divaddinfoshow").append($("#finfotypeid").find("option:selected").text() + "：" + $("#finfoid").find("option:selected").text() + "。  ");

                layer.msg(data.info, { icon: 1 });
                if ($("#c_dcinfo").is(':checked')) {
                    $('#finfoid').val("");
                    $('#finfofv1').val("");
                    if (uiform) uiform.render('select');
                }
                if ($("#c_taskinfo").is(':checked')) {
                    $('#ftaskid').val("0");
                    $('#finfonv1').val(0);
                    $('#fthistaskinfo').val("");
                    $('#selecttaskinfo').val("");
                    if (uiform) uiform.render('select');
                }
            }
            else {
                layer.alert(data.info, { icon: 2 });
            }
        }

    </script>
</body>
</html>
